package structure;

public class branch04 {
    public static void main(String[] args) {
//        d0-while循环，先执行后判断
        //打印5行Hello World
        int i = 0;                               //初始化语句
        do{
            System.out.println("Hello World");   //循环体语句
            i++;                                 //迭代语句
        }while(i < 5);                           //循环条件


//        死循环
        //for的死循环
       /* for( ; ; ){
            System.out.println("Hello World");
        }*/
        //while的死循环
        /*while(true){
            System.out.println("Hello World");
        }
        */
        //do-while死循环
      /*  do{
            System.out.println("Hello World");
        }while (true);
*/

//       循环嵌套（循环中包含循环）
        //说三天，每天五次“我爱你”
        for(int a = 1; a <= 3; a++){
            for (int j = 1; j <= 5; j++){
                System.out.println("我爱你");
            }
            System.out.println(a);
        }

        //打印三行四列*
        for(int a = 1; a <= 3; a++){
            for(int j = 1; j <= 4; j++){
                System.out.print("*");   //println是换行，需要改成print
            }
            System.out.println();
        }
    }
}
